﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;

using MpSoft.Library.BUSS.Categories;
using MpSoft.Library.BUSS.Contents;
using MpSoft.Library.BUSS.Products;
using MpSoft.Library.BUSS.Customers;
using MpSoft.Library.BUSS.Settings;
using MpSoft.Library.DTO;
using MpSoft.Basic.Utils;
using Newtonsoft.Json;

namespace MpSoft.Web.Services
{
    public partial class Response : System.Web.UI.Page
    {
        #region Var

        private int pageCurrent = 1;
        private int pageSize = 10;
        private int type = 0, sEcho = 1;
        private string name = string.Empty;
        #endregion

        #region Method Admin

        #region Customer

        #region Customer

        [WebMethod]
        public static int delCust(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                var arrID = ids.Split(',');
                int value = 0;
                foreach (var id in arrID)
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        int.TryParse(id, out value);
                        CustomerBUSS.Customer_Delete(value);
                    }
                }
                return 1;
            }
            return -1;
        }

        #endregion

        #region Contact

        [WebMethod]
        public static Contact getContact(int cid)
        {
            return ContactBUSS.Contact_ByID(cid);
        }

        [WebMethod]
        public static int delContact(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                var arrID = ids.Split(',');
                int value = 0;
                foreach (var id in arrID)
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        int.TryParse(id, out value);
                        ContactBUSS.Contact_Delete(value);
                    }
                }
                return 1;
            }
            return -1;
        }

        #endregion

        #region Poll

        [WebMethod]
        public static int delPoll(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                var arrID = ids.Split(',');
                int value = 0;
                foreach (var id in arrID)
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        int.TryParse(id, out value);
                        PollBUSS.Poll_Delete(value);
                    }
                }
                return 1;
            }
            return -1;
        }
        [WebMethod]
        public static int PollOrder(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = PollBUSS.Poll_ByID(itemid);
                switch (type)
                {
                    case "order":
                        obj.DisplayOrder = val;
                        break;
                    case "act":
                        if (obj.Published)
                            obj.Published = false;
                        else
                            obj.Published = true;
                        break;
                }
                if (PollBUSS.Poll_Update(obj) > 0)
                    return 1;
            }
            return -1;

        }

        #endregion

        #region Support

        [WebMethod]
        public static int delSupport(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                var arrID = ids.Split(',');
                int value = 0;
                foreach (var id in arrID)
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        int.TryParse(id, out value);
                        SupportBUSS.Support_Delete(value);
                    }
                }
                return 1;
            }
            return -1;
        }

        [WebMethod]
        public static int SupportOrder(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = SupportBUSS.Support_ByID(itemid);
                switch (type)
                {
                    case "order":
                        obj.SortOrder = val;
                        break;
                    case "act":
                        if (obj.IsActive)
                            obj.IsActive = false;
                        else
                            obj.IsActive = true;
                        break;
                }
                if (SupportBUSS.Support_Update(obj) > 0)
                    return 1;
            }
            return -1;

        }

        #endregion

        #region Order

        [WebMethod]
        public static int orderUpVal(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = OrderBUSS.Order_ByID(itemid);
                if (obj != null)
                {
                    switch (type)
                    {
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (OrderBUSS.Order_Update(obj) > 0)
                        return 1;
                }
            }
            return -1;
        }

        [WebMethod]
        public static int orderDel(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (OrderBUSS.Order_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        #endregion

        #endregion

        #region Shipping Method

        [WebMethod]
        public static int shipUpVal(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = ShippingMethodBUSS.ShippingMethod_ByID(itemid);
                if (obj != null)
                {
                    switch (type)
                    {
                        case "order":
                            obj.DisplayOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (ShippingMethodBUSS.ShippingMethod_Update(obj) > 0)
                        return 1;
                }
            }
            return -1;
        }

        [WebMethod]
        public static int shipDel(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (ShippingMethodBUSS.ShippingMethod_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        #endregion

        #region Payment Method

        [WebMethod]
        public static int payUpVal(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = PaymentMethodBUSS.PaymentMethod_ByID(itemid);
                if (obj != null)
                {
                    switch (type)
                    {
                        case "order":
                            obj.DisplayOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (PaymentMethodBUSS.PaymentMethod_Update(obj) > 0)
                        return 1;
                }
            }
            return -1;
        }

        [WebMethod]
        public static int payDel(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (PaymentMethodBUSS.PaymentMethod_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        #endregion

        #region Category

        [WebMethod]
        public static int CateActive(int itemid)
        {
            if (itemid > 0)
            {
                var obj = CategoryBUSS.Category_GetByID(itemid);
                obj.IsActive = obj.IsActive ? false : true;
                return CategoryBUSS.Category_Update(obj);
            }
            return -1;

        }

        [WebMethod]
        public static int CateOrder(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = CategoryBUSS.Category_GetByID(itemid);
                switch (type)
                {
                    case "order":
                        obj.SortOrder = val;
                        break;
                    case "act":
                        if (obj.IsActive)
                            obj.IsActive = false;
                        else
                            obj.IsActive = true;
                        break;
                }
                if (CategoryBUSS.Category_Update(obj) > 0)
                    return 1;
            }
            return -1;

        }

        [WebMethod]
        public static int CateDelete(string ids)
        {

            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (CategoryBUSS.Category_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        [WebMethod]
        public static int UpdateMenu(int cateid, string menuid)
        {
            if (cateid > 0)
            {
                var obj = CategoryBUSS.Category_GetByID(cateid);
                if (obj != null)
                {
                    string[] arr = obj.MenuID.Split(',');
                   
                    string value = string.Empty;
                    if (arr.Contains(menuid))
                    {
                        arr = arr.Where(c => c != menuid).ToArray();
                        obj.MenuID = string.Join(",", arr);
                    }
                    else
                    {
                        string mn = string.Join(",", arr);
                        obj.MenuID = string.IsNullOrEmpty(mn) ? menuid : mn + "," + menuid;
                    }
                    if (CategoryBUSS.Category_Update(obj) > 0)
                        return 1;
                }
            }
            return -1;
        }

        [WebMethod]
        public static int UpOrder(int cateid, int  order)
        {
            if (cateid > 0)
            {
                var obj = CategoryBUSS.Category_GetByID(cateid);
                if (obj != null)
                {
                    obj.SortOrder = order;
                    if (CategoryBUSS.Category_Update(obj) > 0)
                        return 1;
                }
            }
            return -1;
        }

        [WebMethod]
        public static string CateMenu(string parent, string menuid)
        {
            int parentid;
            int.TryParse(parent, out parentid);
            StringBuilder sb = new StringBuilder();
            var sub_categories = CategoryBUSS.Category_ByParentID(parentid, null, menuid, 0);
            int index = 1;
            if (sub_categories != null)
                sb.Append(CateMenuSub("", ref index, menuid, sub_categories));
            return sb.ToString();
        }

        private static string CateMenuSub(string space,ref int index,string menuid, List<Category> listcate)
        {
            StringBuilder sb = new StringBuilder(4454);
            if (listcate.Count > 0)
            {
                foreach (var obj in listcate)
                {
                    sb.Append("<tr><td class='tb-stt'>" + index + "</td><td>" + space + obj.CategoryName +
                        "</td><td><input type='text' class='tb-text' title='" + obj.CategoryID + "' value='" + obj.SortOrder + "'></td>" +
                        "<td class='tb-options'><a href='" + obj.CategoryID + "' class='btn Delete' rel='tooltip' title='Delete'><i class='fa fa-times'></i></a></td></tr>");
                    var sub_categories = CategoryBUSS.Category_ByParentID(obj.CategoryID, null, menuid, 0);
                    if (sub_categories != null)
                    {
                        index = index + 1;
                        sb.Append(CateMenuSub("--|" + space, ref index, menuid, sub_categories));
                    }
                    index = index + 1;
                }
            }
            return sb.ToString();
        }

        private void Category_List()
        {
            var listCategory = CategoryBUSS.Category_List(-1, -1, null, null, null, 0, 1);
            var result = new
            {
                aaData = listCategory == null ? null : listCategory,
                sEcho = sEcho,
                iTotalDisplayRecords = 500,
                iTotalRecords = listCategory == null ? 0 : listCategory.Count
            };
            Response.Write(JsonConvert.SerializeObject(result));
        }

        #endregion

        #region News

        [WebMethod]
        public static int NewsActive(int itemid)
        {
            if (itemid > 0)
            {
                var obj = NewsBUSS.News_ByID(itemid);
                obj.IsActive = obj.IsActive ? false : true;
                return NewsBUSS.News_Update(obj);
            }
            return -1;

        }

        [WebMethod]
        public static int NewsOrder(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                if (itemid > 0)
                {
                    var obj = NewsBUSS.News_ByID(itemid);
                    switch (type)
                    {
                        case "order":
                            obj.SortOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (NewsBUSS.News_Update(obj) > 0)
                        return 1;
                }
                return -1;
            }
            return -1;

        }

        [WebMethod]
        public static int NewsDelete(string ids)
        {

            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (NewsBUSS.News_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        //private void News_List()
        //{
        //    var list = NewsBUSS.News_List(-1, -1, 0, 1,null);
        //    var tbNews = new
        //    {
        //        aaData = list,
        //        sEcho = sEcho,
        //        iTotalDisplayRecords = 500,
        //        iTotalRecords = list.Count
        //    };
        //    Response.Write(JsonConvert.SerializeObject(tbNews));
        //}

        #endregion

        #region Download

        [WebMethod]
        public static int DownUpVal(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                if (itemid > 0)
                {
                    var obj = DownloadBUSS.Download_ByID(itemid);
                    switch (type)
                    {
                        case "order":
                            obj.SortOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (DownloadBUSS.Download_Update(obj) > 0)
                        return 1;
                }
                return -1;
            }
            return -1;

        }

        [WebMethod]
        public static int DownDelete(string ids)
        {

            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (DownloadBUSS.Download_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        #endregion

        #region Product

        [WebMethod]
        public static int ProdUpVal(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = ProductBUSS.Product_ByID(itemid);
                if (obj != null)
                {
                    switch (type)
                    {
                        case "exists":
                            if (val == 1)
                                obj.IsExist = true;
                            else 
                                obj.IsExist = false;
                            break;
                        case "vat":
                            if (val == 1)
                                obj.IsVAT = true;
                            else
                                obj.IsVAT = false;
                            break;
                        case "new":
                            if (val == 1)
                                obj.IsHome = true;
                            else
                                obj.IsHome = false;
                            break;
                        case "hot":
                            if (val == 1)
                                obj.IsHot = true;
                            else
                                obj.IsHot = false;
                            break;
                        case "sellgood":
                            if (val == 1)
                                obj.IsSellGood = true;
                            else
                                obj.IsSellGood = false;
                            break;
                        case "promotion":
                            if (val == 1)
                                obj.IsPromotion = true;
                            else
                                obj.IsPromotion = false;
                            break;
                        case "order":
                            obj.SortOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (ProductBUSS.Product_Update(obj) > 0)
                        return 1;
                }
            }
            return -1;

        }
        [WebMethod]
        public static int prodDel(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (ProductBUSS.Product_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        #endregion

        #region Manufacturer

        [WebMethod]
        public static int manuUpVal(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = ManufacturerBUSS.Manufacturer_ByID(itemid);
                if (obj != null)
                {
                    switch (type)
                    {
                        case "order":
                            obj.SortOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (ManufacturerBUSS.Manufacturer_Update(obj) > 0)
                        return 1;
                }
            }
            return -1;
        }

        [WebMethod]
        public static int manuDel(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (ManufacturerBUSS.Manufacturer_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        #endregion

        #region Atribute

        [WebMethod]
        public static int attrUpVal(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                var obj = AttributeBUSS.Attribute_ByID(itemid);
                if (obj != null)
                {
                    switch (type)
                    {
                        case "order":
                            obj.SortOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (AttributeBUSS.Attribute_Update(obj) > 0)
                        return 1;
                }
            }
            return -1;
        }

        [WebMethod]
        public static int attrDel(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                string[] arrCate = ids.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (AttributeBUSS.Attribute_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        #endregion

        #region AttributeValue

        [WebMethod]
        public static void attValueUpVal(string name, string value, int pk)
        {
            if(pk>0)
            {
                var obj = AttributeValueBUSS.AttributeValue_ByID(pk);
                switch (name)
                {
                    case "edit":
                        obj.Value = value;
                        AttributeValueBUSS.AttributeValue_Update(obj);
                        break;
                }
            }
        }

        #endregion

        #region Article

        private void Category_ListArticle()
        {
            var listCategory = CategoryBUSS.Category_List(-1, -1, null, "bai-viet", null, 0, 1);
            var result = new
            {
                aaData = listCategory == null ? null : listCategory,
                sEcho = sEcho,
                iTotalDisplayRecords = 500,
                iTotalRecords = listCategory == null ? 0 : listCategory.Count
            };
            Response.Write(JsonConvert.SerializeObject(result));
        }

        #endregion

        #region Product

        [WebMethod]
        public static int ProdActive(int itemid)
        {
            if (itemid > 0)
            {
                var obj = ProductBUSS.Product_ByID(itemid);
                obj.IsActive = obj.IsActive ? false : true;
                return ProductBUSS.Product_Update(obj);
            }
            return -1;

        }

        [WebMethod]
        public static int ProdOrder(int itemid, int value)
        {
            if (itemid > 0)
            {
                var obj = ProductBUSS.Product_ByID(itemid);
                obj.SortOrder = value;
                return ProductBUSS.Product_Update(obj);
            }
            return -1;

        }

        [WebMethod]
        public static int ProdDelete(string deletes)
        {

            if (!string.IsNullOrEmpty(deletes))
            {
                string[] arrCate = deletes.Split(',');
                int state = 0;
                for (int i = 0; i < arrCate.Length; i++)
                    if (ProductBUSS.Product_Delete(int.Parse(arrCate[i])) > 0)
                        state = 1;
                return state;
            }
            return -1;
        }

        private void Product_List()
        {
            //var list = ProductBUSS.Product_List(-1, 0, 0, false, false, false, false);
            //var result = new
            //{
            //    aaData = list == null ? null : list,
            //    sEcho = sEcho,
            //    iTotalDisplayRecords = 500,
            //    iTotalRecords = list == null ? 0 : list.Count
            //};
            //Response.Write(JsonConvert.SerializeObject(result));
        }

        #endregion

        #region Advs

        [WebMethod]
        public static int delAdvs(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                var arrID = ids.Split(',');
                int value = 0;
                foreach (var id in arrID)
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        int.TryParse(id, out value);
                        AdvBUSS.Adv_Delete(value);
                    }
                }
                return 1;
            }
            return -1;
        }
        [WebMethod]
        public static int AdvUp(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                if (itemid > 0)
                {
                    var obj = AdvBUSS.Adv_ByID(itemid);
                    switch (type)
                    {
                        case "order":
                            obj.SortOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (AdvBUSS.Adv_Update(obj) > 0)
                        return 1;
                }
                return -1;
            }
            return -1;

        }

        #endregion

        #region Gallery

        [WebMethod]
        public static int delGallery(string ids)
        {
            if (!string.IsNullOrEmpty(ids))
            {
                var arrID = ids.Split(',');
                int value = 0;
                foreach (var id in arrID)
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        int.TryParse(id, out value);
                        GalleryBUSS.Gallery_Delete(value);
                    }
                }
                return 1;
            }
            return -1;
        }

        [WebMethod]
        public static int GelleryUp(string type, int itemid, int val)
        {
            if (itemid > 0)
            {
                if (itemid > 0)
                {
                    var obj = GalleryBUSS.Gallery_ByID(itemid);
                    switch (type)
                    {
                        case "order":
                            obj.SortOrder = val;
                            break;
                        case "act":
                            if (obj.IsActive)
                                obj.IsActive = false;
                            else
                                obj.IsActive = true;
                            break;
                    }
                    if (GalleryBUSS.Gallery_Update(obj) > 0)
                        return 1;
                }
                return -1;
            }
            return -1;

        }

        #endregion

        private void Menu()
        {
            switch (type)
            { 
                case 1:
                    Category_List();
                    break;
                case 3:
                    Category_ListArticle();
                    break;
                case 4:
                    Product_List();
                    break;
                default:
                    break;
            }
        }

        #endregion

        #region Utils


        #endregion

        #region Website

        [WebMethod]
        public static string GetNewsByCate(int cateid)
        {
            var list = NewsBUSS.News_List(cateid, 1, 1);
            string[] _DayOfWeek = { "Chủ nhật", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7" };
            if (list != null)
            {
                StringBuilder sb = new StringBuilder(323);
                var obj = list[0];
                string url = string.Format(obj.FormatUrl, obj.NewsID);
                sb.Append("<div class='news-hot'>");
                sb.Append("<a class='img' href='" + url + "'><img alt='" + obj.Title + "' src='" + obj.Image + "'/></a>");
                sb.Append("<h3><a title='"+obj.Title+"' href='" + url + "'>" + obj.Title + "</a></h3>");
                sb.Append("<i>" + string.Format(_DayOfWeek[(int)obj.DateCreate.DayOfWeek] + ", {0:dd/MM/yyyy}", obj.DateCreate) + "</i>");
                sb.Append("<span>" + obj.Description + "</span>");
                sb.Append("<p><a href='" + url + "'>+Chi tiết</a></p>");
                sb.Append("</div>");
                if (list.Count > 1)
                {
                    sb.Append("<ul class='news-orther'>");
                    int i = 0;
                    for (int j = 1; j < list.Count;j++ )
                    {
                        obj = list[j];
                        url = string.Format(obj.FormatUrl, obj.NewsID);
                        sb.Append(i % 4 == 0 ? "<li><a href='" + url + "'>" + obj.Title + "</a>" : "<a href='" + url + "'>" + obj.Title + "</a>");
                        sb.Append(i % 4 == 3 ? "</li>" : "");
                        if (i == 7) break;
                        i++;
                    }
                    if (i % 4 != 3) sb.Append("</li>");
                    sb.Append("</ul>");
                }
                return sb.ToString();
            }
            return "";
        }

        #endregion

        #region Event

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["type"] != null)
                int.TryParse(Request.QueryString["type"].ToString(), out type);
            if (Request.QueryString["pagesize"] != null)
                int.TryParse(Request.QueryString["pagesize"].ToString(), out pageSize);
            if (Request.QueryString["pagecurrent"] != null)
                int.TryParse(Request.QueryString["pagecurrent"].ToString(), out pageCurrent);
            if (Request.QueryString["name"] != null)
                name = Request.QueryString["name"].ToString();
            if (Request.QueryString["sEcho"] != null)
                sEcho = int.Parse(Request.QueryString["sEcho"].ToString());
            Menu();
            //string[] arr = "menu-top,menu-left,home".Split(',');
            //arr = arr.Where(c => c != "menu-top").ToArray();
            //Response.Write(string.Join(",", arr));
        }

        #endregion
    }
}